package com.bankcomm.creditcard.redfriday.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bankcomm.creditcard.redfriday.R;

public class ActivityActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity);

		TextView titleTextView = (TextView) findViewById(R.id.header_title);
		titleTextView.setText(R.string.activity);

		Button backBtn = (Button) findViewById(R.id.header_back);
		backBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});

		String[] titleArray = getResources().getStringArray(
				R.array.activity_array);
		// String[] infoArray = getResources().getStringArray(
		// R.array.activity_info_array);
		String[] infoArray = new String[3];
		infoArray[0] = "活动简介：<font color=\"red\">每周五</font>至参加活动的超市，刷交通银行信用卡，单笔消费满128元，劲享<font color=\"red\">5%</font>刷卡金奖励！交通银行白金信用卡可享<font color=\"red\">10%</font>刷卡金奖励！";
		infoArray[1] = "活动简介：<font color=\"red\">每周五</font>至参加活动的加油站，刷交通银行信用卡，单笔消费满200元即可享<font color=\"red\">5%</font>刷卡金奖励！交通银行白金信用卡可享<font color=\"red\">10%</font>刷卡金奖励！";
		infoArray[2] = "活动简介：首次成功申请交通银行信用卡的新用户，在活动任一指定商户单笔刷卡消费满50元，即可获赠<font color=\"red\">50元</font>刷卡金！";

		RelativeLayout layout1 = (RelativeLayout) findViewById(R.id.activity_layout1);
		TextView titleTextView1 = (TextView) findViewById(R.id.activity_listview_item_title1);
		titleTextView1.setText(titleArray[0]);
		TextView infoTextView1 = (TextView) findViewById(R.id.activity_listview_item_info1);
		infoTextView1.setText(Html.fromHtml(infoArray[0]));
		layout1.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getApplicationContext(),
						ActivityDetailActivity.class);
				intent.putExtra("index", 0);
				startActivity(intent);
			}
		});

		RelativeLayout layout2 = (RelativeLayout) findViewById(R.id.activity_layout2);
		TextView titleTextView2 = (TextView) findViewById(R.id.activity_listview_item_title2);
		titleTextView2.setText(titleArray[1]);
		TextView infoTextView2 = (TextView) findViewById(R.id.activity_listview_item_info2);
		infoTextView2.setText(Html.fromHtml(infoArray[1]));
		layout2.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getApplicationContext(),
						ActivityDetailActivity.class);
				intent.putExtra("index", 1);
				startActivity(intent);
			}
		});

		RelativeLayout layout3 = (RelativeLayout) findViewById(R.id.activity_layout3);
		TextView titleTextView3 = (TextView) findViewById(R.id.activity_listview_item_title3);
		titleTextView3.setText(titleArray[2]);
		TextView infoTextView3 = (TextView) findViewById(R.id.activity_listview_item_info3);
		infoTextView3.setText(Html.fromHtml(infoArray[2]));
		layout3.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getApplicationContext(),
						ActivityDetailActivity.class);
				intent.putExtra("index", 2);
				startActivity(intent);
			}
		});

	}
}
